package com.xjh.basestudy.javabase.Collection;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Map4 {
    public static void main(String[] args) {
        //创建集合对象
        Map<String,String> map = new HashMap<String,String>();
        //添加元素
        map.put("nana","娜娜");
        map.put("Jianhua","建华");
        //获取键的集合
        Set<String> keySet = map.keySet();
        //遍历键的集合
        for(String key:keySet){
            //根据键去找值，用get（Object key）方法实现
            String value = map.get(key);
            System.out.println(key+","+value);
        }

    }
}
